<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">
    <title>风险偏好评估</title>
    {% load static %}
    <link href="{% static 'taa/style.css' %}" rel="stylesheet" type="text/css">
</head>
<body>
<main class="cmp640 ">

    <div id="box2">
        {% csrf_token %}
        <div class="wrap">
            <h1>风险偏好评估</h1>
            <div style="border-bottom:1px dashed #ddd;"></div>
            <div style="margin-top:20px;text-align: center">
                <div class="fengxian">您已完成风险测评，您的风险等级为</div>
                <h3 class="investStyle" id="investType">{{investType}}</h3>


            </div>
            <div id="title1" style="margin-top:20px;">
                <h3>请输入您的手机号:</h3>
                <ul class="textDiv">

                    <li class="one">
                        <input type="text" id="tel" class="nums" placeholder="请输入您的手机号"/>
                    </li>
                </ul>
            </div>

            <input type="hidden" value="{{ risk_num }}" id="risk_num"/>
        </div>
        <div class="txt-c width-5 hang40" style="margin:0 auto;">
            <div class="zi-bai bg-lan" style="border-radius:25px;cursor: pointer" onclick="infoSub()">
                <span>提交</span>
            </div>
        </div>
        <div class="hang80"></div>
    </div>
</main>


<!-- All JS -->
<script type="text/javascript" src="../../static/taa/jquery-1.11.0.min.js"></script>

<script type="text/javascript">
    function infoSub() {

        var csrfmiddlewaretoken = '{{ csrf_token }}';
        var mobile_numer = $("#tel").val();
        if (mobile_numer.length != 11) {
            alert("请输入正确手机号")
        } else {
            var send_data = {
                "mobile_numer": $("#tel").val(),
                "risk_num": $("#risk_num").val(),
                "csrfmiddlewaretoken": csrfmiddlewaretoken,
            };

            $.ajax({
                url: "/taa/risk/data",
                type: "POST",
                data: JSON.stringify(send_data),
                contentType: "application/json",
                dataType: "json",
                success: function (data) {
                    if (data["status"] == "success") {
                        location.href = '/taa/' + data['rowkey'] + '/finance'
                    }

                }
            })
        }

    }
</script>

</body>
</html>